﻿using Eleven_TwoWeek_HD.Model;

namespace Eleven_TwoWeek_HD.DAL
{
    public class VouchersDal
    {
        private readonly Mycontext context;

        public VouchersDal(Mycontext _context)
        {
            context = _context;
        }
        public int VouchersAdd(Vouchers Z)
        {
            try
            {
                var H = context.Voteers.Count(G=>G.VouchersId==Z.VouchersId);
                if (H == 0)
                {
                    context.Voteers.Add(Z);
                    return context.SaveChanges();
                }
                return -1;
            }
            catch (Exception)
            {

                throw;
            }
        }
    }
}